from PyQt5.Qt import *
from demo_386_MyBtn import MyBtn


class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('demo_386_custom_signal')
        self.resize(500, 500)
        self.setup_ui()

    def setup_ui(self):
        btn = MyBtn('xxx', self)
        btn.rightClicked.connect(lambda: print('right button is pressed'))
        btn.clicked.connect(lambda: print('left button is pressed'))
        #btn.signal_with_param[str].connect(lambda content: print('with one string param:', content))
        #btn.signal_with_param[int, str].connect(lambda val, content: print('get val and content', val, content))
        btn.signalWithParam[str].connect(lambda content: print('with one string param:', content))
        btn.signalWithParam[int, str].connect(lambda val, content: print('get val and content', val, content))


if __name__ == '__main__':
    import sys
    app = QApplication(sys.argv)

    win = Window()
    win.show()

    sys.exit(app.exec_())
